<template>
	<view class="content" v-if="show==1">
		<view class="zhong">
		    <view class="order" v-for="u in user">
				<view class="zhitiao">
					<image :src="u.avatar" mode="aspectFill"></image>
					<view class="zhitiao2">
						<view class="zhitiao2-1">{{u.nickname}}</view>
						<view class="zhitiao2-2">{{u.createtime}}</view>
					</view>
					
				</view>
		    </view>
			<view class="empty" v-if="!user[0]">暂无数据</view>
			
			<view style="width:100%;height:20px;"></view>
		</view>
		
	</view>
</template>

<script>
	var app=getApp();
	export default {
		data() {
			return {
				uid:0,
				show:0,
				next:0,
				page:1,
				user:[]
			}
		},
		onLoad(){
			const uid = uni.getStorageSync('uid');
			if(app.isBlank(uid)==true){
				app.error_msg("请先登录");
			}
			this.uid=uid;
			this.getdata();
		},
		methods: {
			getdata(){
				var that=this;
				uni.showLoading({
				    title: '数据加载中'
				});
				uni.request({
				    url: app.globalData.url+"user/dluser",
					method:"POST",
					dataType:"json",
					header: {
					    'content-type': 'application/x-www-form-urlencoded'
					},
				    data: {uid:that.uid,page:that.page},
				    success: (res) => {
						uni.hideLoading();
						if(res.data.code!=1){
							app.error_msg(res.data.msg);
						}
						that.user=that.user.concat(res.data.data.user)
						that.next=res.data.data.next
						that.page++;
						that.show=1;
				    }
				});
			},
			onReachBottom(){
				if(this.next==1){
					this.next=0;
					this.getdata();
				}
			}
		}
	}
</script>

<style>
	.zhitiao2-2{width:100%;height:25px;line-height: 25px;font-size: 0.8rem;overflow: hidden;color:#999;}
	.zhitiao2-1{width:100%;height:25px;line-height: 25px;font-size: 0.9rem;overflow: hidden;}
	.zhitiao image{width:50px;height:50px;margin-right: 10px;border-radius: 5px;}
	.zhitiao2{width:100%;flex:1;}
	.zhitiao{width:94%;display: flex;margin: 0 auto;}
	
	.empty{width:100%;text-align: center;font-size: 1rem;margin-top: 40%;}
	page{background-color: rgb(245, 245, 245);}

	.order{width:100%;margin-top: 15px;background-color: #fff;border-radius: 5px;padding: 8px 0px;}
	.zhong{width:94%;margin: 0 auto;}
</style>
